<template>
  <div class="publit_right">
    <div class="side_right_nav_sy">
      <div class="side_top">
        <div class="iconfont icon-youzhijiantou1"></div>
        <div>{{ titleCc }}</div>
      </div>
      <div
        class="side_li"
        :class="index == sideNavSelc ? 'active' : ''"
        v-for="(item, index) in sideNavc"
        :key="index"
        @click="sideNavSelC(index)"
      >
        <div class="l_title">{{ item.title }}</div>
        <div class="iconfont icon-jiantou-shuangyou"></div>
      </div>
    </div>
    <div class="hot_msg_sy">
      <div class="huiyuan_gaunli" v-if="isHuiyuan">
        <div class="side_top">
          <div class="iconfont icon-youzhijiantou1"></div>
          <div>信息展示</div>
        </div>
        <div class="hang_h">
          <div class="title_h">我的钱包</div>
          <div class="cont_money"> <span class="red">300 </span>元</div>
          <div class="tixian_btn"  @click="dialogVisible = true">提现</div>
        </div>
        <div class="hang_h">
          <div class="title_h">修改密码</div>
          <el-button size="mini" type="primary" ><router-link :to="{path:'/loginIn',query:{sel:1}}" class="color_fff">修改</router-link></el-button>
          
        </div>
      </div>
    </div>
    <div class="hot_msg_sy" v-if="!isHuiyuan">
      <div class="side_top">
        <div class="iconfont icon-youzhijiantou1"></div>
        <div>热门信息</div>
      </div>
      <div class="hot_body">
        <div
          class="hang_hot"
          v-for="(item, index) in part1_2listC"
          :key="index"
          @click="nativeDetail(item)"
        >
          <div class="tab_left shengluehao">
            <div class="iconfont icon-triangle-right"></div>
            <div class="shengluehao url">{{ item.title }}</div>
          </div>
        </div>
      </div>
    </div>
    <div class="search_sy" v-if="!isHuiyuan">
      <el-input
        placeholder="请输入内容"
        v-model="searchVal"
        class="input_search"
      >
        <div class="title_search" slot="prepend">全文搜索</div>
        <el-button slot="append" icon="el-icon-search" @click="searchKey"></el-button>
      </el-input>
    </div>
    <div class="img_sy">
      <img src="@assets/img/ww.jpg" alt="" />
    </div>
    <el-dialog
      title="提示"
      :visible.sync="dialogVisible"
      width="600px"
      >
      <div class="guanzhu_tixian">
         <img src="@assets/img/bg-weixin.jpg" alt="" />
         <div class="tishi">
           关注公众号提现
         </div>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button type="primary" @click="dialogVisible = false">关闭</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
export default {
  components: {},
  props: {
    titleC: String,
    sideNavSel: [String, Number],
    sideNav: {
      type: Array,
      default: () => [],
    },
    isHuiyuan: {
      type: Boolean,
      default: false,
    },
  },
  watch: {},
  computed: {
    part1_2listC() {
      if(this.carouselArr2.length > 0 ){
        return this.carouselArr2.slice(0, 4);
      }else{
        return []
      }
    },
    titleCc() {
      return this.titleC;
    },
    sideNavSelc() {
      return this.sideNavSel;
    },
    sideNavc() {
      return this.sideNav;
    },
  },
  mounted(){
    this.$getApi("/common/home", {key:this.biaotiInput}).then((res) => {
      console.log(res.data,'首页内容');
      let dataL = res.data;

      this.carouselArr2  = dataL.articlelist
      // this.ListPart1 = dataL.data.slice(0,9)
    });
  },
  data() {
    return {
      dialogVisible:false,
      carouselArr2: [],
      searchVal: "",
    };
  },

  methods: {
    sideNavSelC(index) {
      this.$emit("sideNavSelC", index);
    },
    nativeDetail(item){
      console.log(item)
      this.$router.push({ path: "/detail", query: { sel: 0,parentId:item.id,type:1,from:'home' } });
    },
    searchKey(){
      this.$emit("searchKey",this.searchVal)
    }
  },
};
</script>

<style scoped lang="stylus">
.guanzhu_tixian{
  text-align center  
}
.huiyuan_gaunli {
  .hang_h{
    display flex
    padding 14px 26px
    align-items center
    +.hang_h{
      border-top 1px solid #f0f0f0
    }
    .title_h{
      font-size 16px
      margin-right 20px

    }
    .cont_money{
      font-size 16px
    }
  }
}
</style>
